<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<script language="javascript">
	function printThesisDetails(thesisId){
		$('#thesisId').val(thesisId);
		$('#thesisDetailsForm1').attr('action', 'printThesisDetails.html');
		$('#thesisDetailsForm1').submit();
	}
</script>

<%@include file="/ui/jsp/includes/header.jspf"%>
<div class="container-fluid">
	<form id="thesisDetailsForm1" class="form-horizontal" method="POST" target="_blank">
		<div class="addnew_button" align="right">
			<input type="button" title="Display in a Print-friendly Format" value="Print" onclick="javascript:printThesisDetails('${thesis.thesisId}')" class="btn btn-primary">
		</div>
		<div id="top" class="hero-unit">
			<div id="thesis-details-header">
				Thesis Details
			</div>
			<hr/>
			<div class="control-group">
				<label class="control-label">Thesis Title:</label>
				<div class="controls">${thesis.title}</div>
				<br/>
				<label class="control-label">Abstract:</label>
				<div class="controls">${thesis.abstract_}</div>
				<c:if test="${empty thesis.abstract_}">
				<br/>
				</c:if>
				<label class="control-label">Thesis DOI:</label>
				<div class="controls">${thesis.thesisDoi}</div>
				<c:if test="${empty thesis.thesisDoi}">
				<br/>
				</c:if>
				<label class="control-label">Category:</label>
				<div class="controls">${thesis.category.categoryName}</div>
				
<!-- 				<label class="control-label">Start Date:</label> -->
<%-- 				<div class="controls"><fmt:formatDate type="date" pattern="MM/dd/yyyy" value="${thesis.startDate}"/></div> --%>
			</div>
		</div>
		<input type="hidden" id="thesisId" name="thesisId" value=""/>
	</form>
	<form class="form-horizontal">

		<div id="bottom-right" class="hero-unit">

			<div id="thesis-details-header">
				Student Details
			</div>
			<hr/>
			<div class="control-group">

				<label class="control-label">First Name:</label>
				<div class="controls">${thesis.student.firstName}</div>
				<label class="control-label">Last Name:</label>
				<div class="controls">${thesis.student.lastName}</div>
				<label class="control-label">Email:</label>
				<div class="controls">${thesis.student.email}</div>
				<c:if test="${empty thesis.student.email}">
                <br/>
                </c:if>
		
				<label class="control-label">Major:</label>
				<div class="controls">${thesis.student.major}</div>
				<c:if test="${empty thesis.student.major}">
				<br/>
				</c:if>

				<label class="control-label">Year Graduated:</label>
				<div class="controls">${thesis.student.yearGraduated}</div>

			</div>
		</div>
		
	</form>
	<form class="form-horizontal">
		<div id="bottom-left" class="hero-unit">
			<div id="thesis-details-header">
			Thesis Committee Details
			</div>
			<hr/>
			<div class="control-group">
				<label class="control-label">Committee Chair:</label>
				<div class="controls">${thesis.thesisChairName}</div>
				<label class="control-label">Member 1:</label>
				<div class="controls">${thesis.committeeMember1Name}</div>
				<c:if test="${empty thesis.committeeMember1Name}">
				<br/>
				</c:if>
				
				<label class="control-label">Member 2:</label>
				<div class="controls">${thesis.committeeMember2Name}</div>
				<c:if test="${empty thesis.committeeMember2Name}">
				<br/>
				</c:if>
				
 			<c:if test="${!empty thesis.committeeMember3Name}">
				<label class="control-label">Member 3:</label>
				<div class="controls">${thesis.committeeMember3Name}</div>
 			</c:if>

				<c:if test="${empty thesis.committeeMember3Name}">
                <br/>
                </c:if>
		
				<c:if test="${!empty thesis.committeeMember4Name}">
				<label class="control-label">Member 4:</label>
				<div class="controls">${thesis.committeeMember4Name}</div>
 				</c:if>
				<c:if test="${empty thesis.committeeMember4Name}">
                <br/>
                </c:if>
				
				
				<div class="controls">${thesisStatus.thesisToThesisStatuses.thesis}</div>
			</div>
		</div>
	</form>

	<div class="span10">
		<div id="thesis-details-header">
			Thesis Status Details
		</div>
		<hr />
		<table class="table table-striped table-bordered">
			<thead>
				<tr>
					
					<th>Milestone Completed</th>
					<th>Date</th>
					
				</tr>
			</thead>

			<tbody>
				
				<c:forEach var="milestoneOverview" items="${thesis.milestoneOverview}">
<%-- 				<c:forEach var="thesisStatusOverviewDates" items="${thesis.thesisStatusOverviewDates}"> --%>
					<tr>
						<td><c:out value="${milestoneOverview.getMilestoneString()}"/></td>
						<td><c:out value="${milestoneOverview.getDate()}"/></td>
<%--  						<td><fmt:formatDate type="date" pattern="MM/dd/yyyy" value="${thesisStatusOverviewDates}" /></td> --%>
					</tr>
<%-- 				</c:forEach> --%>
				</c:forEach>
<%-- 					<td>${thesis.title}</td> --%>
<%-- 					<td>${thesis.thesisStatusOverview}</td> --%>
<%-- 					<td>${thesis.student.fullName}</td> --%>
<%--					<td><fmt:formatDate type="date" pattern="MM/dd/yyyy" value="${thesis.startDate}"/></td> --%>
<%-- 					<td>${thesis.comments}</td> --%>
								
			</tbody>

		</table>
	</div>
</div>
<%@include file="/ui/jsp/includes/footer.jspf"%>

<style>
.form-horizontal {
	border: 0 none;
	margin-left: 0px;
	margin-top: 0px;
	padding-top: 0px;
	width: 100%;
}

.form-horizontal .control-label {
	float: left;
	font-weight: bold;
	padding-top: 5px;
	text-align: right;
	width: 160px;
}
</style>